<?php
session_start();
include("lib/lib.php");
include("configado.php");
//header("Content-type: text/html; charset=utf-8");
$email = $_REQUEST['_usr'];
$pwd = $_REQUEST['_pwd'];

$logfile = PAHTLOG."ajax_connldap-" . date("Y-m-d") . ".log";

writelog($logfile, "email           : " . $email);
writelog($logfile, "Password       : " . $pwd);


$parameters = array('email'=> $email ,'pwd'=> $pwd);

$client = new SoapClient('http://10.30.3.95:8080/ConnLdapService/ConnLdap?wsdl', array('trace' => 1));

$client->__soapCall("connLdap", array($parameters));

$ret = $client->__getLastResponse();

//$ret = 1;
if($ret){
	$_SESSION["usrid_login"] = $email;
	$_SESSION["usr_login"] = $email;
	$_SESSION["pwd_login"] = $pwd;
	//setcookie("usrid_login",$email);
    //setcookie("usr_login",$email);
    //setcookie("pwd_login",$pwd);	
}


writelog($logfile, "_SESSION email   : " . $_SESSION['usr_login']);
writelog($logfile, "_SESSION pwd     : " . $_SESSION['pwd_login']);

writelog($logfile, "reply : " . $ret);
writelog($logfile, "-------------------------------------------------- ");

echo $ret;
?>
